package com.isoft.farm.common;

import java.io.Serializable;

public class JsonResult implements Serializable {
    private static final long serialVersionUID = 2949602057968325490L;
    private int state=1;//状态码
    private String message="OK";//日志
    private Object data;//封装传递数据，业务层返回的

    public JsonResult() {
    }


    public JsonResult(String message) {
        this.state=0;
        this.message = message;
    }

    public JsonResult(Object data) {
        this.data = data;
    }

    public JsonResult(Throwable e){
        this.state=0;
        this.message=e.getMessage();
    }

    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    @Override
    public String toString() {
        return "JsonResult{" +
                "state=" + state +
                ", message='" + message + '\'' +
                ", date=" + data +
                '}';
    }

}
